﻿namespace CubeCube.Object.Component
{
    public class ObjectComponent
    {
        protected CCObject ccObject; //挂载的寄主

        internal void AddedToObject(CCObject ccObject)
        {
            this.ccObject = ccObject;

            OnAddedToObject(ccObject);
        }

        internal void RemovedFromObject()
        {
            this.ccObject = null;

            OnRemovedFromObject();
        }

        protected virtual void OnRemovedFromObject()
        {
        }

        protected virtual void OnAddedToObject(CCObject cwobject)
        {
        }

        public virtual void Update(float deltaTime)
        {
        }

    }
}
